home *** CD-ROM | disk | FTP | other *** search
/ boe.pres.k12.wv.us / boe.pres.k12.wv.us.zip / boe.pres.k12.wv.us / Utilities / Xerox Workcentre 5335 / Windows Utilities / Font Management Utility / Deutsch / Xerox Font Management Utility.msi / Data1.cab / F3722_Fmu.chm / skinsupport / madcapbody.js < prev    next >
Text File  |  2009-07-16  |  5KB  |  203 lines

  1. // {{MadCap}} //////////////////////////////////////////////////////////////////
  2. // Copyright: MadCap Software, Inc - www.madcapsoftware.com ////////////////////
  3. ////////////////////////////////////////////////////////////////////////////////
  4. // <version>3.0.0.0</version>
  5. ////////////////////////////////////////////////////////////////////////////////
  6.  
  7. //
  8.  
  9. if ( FMCIsDotNetHelp() || FMCIsHtmlHelp() )
  10. {
  11.     window.name = "body";
  12. }
  13.  
  14. //
  15.  
  16. gOnloadFuncs.push( FMCInit );
  17.  
  18. //
  19.  
  20. var gInit    = false;
  21.  
  22. function FMCInit()
  23. {
  24.     if ( gInit )
  25.     {
  26.         return;
  27.     }
  28.  
  29.     //
  30.  
  31.     FMCCheckForBookmark();
  32.  
  33.     if ( FMCIsWebHelp() && window.name == "body" )
  34.     {
  35.         FMCRegisterCallback( "TOC", MCEventType.OnInit, FMCOnTocInitialized, null );
  36.     }
  37.     
  38.     if ( MCGlobals.ToolbarFrame != null )
  39.     {
  40.         FMCRegisterCallback( "Toolbar", MCEventType.OnInit, FMCOnToolbarLoaded, null );
  41.     }
  42.     
  43.     if ( MCGlobals.BodyCommentsFrame != null )
  44.     {
  45.         FMCRegisterCallback( "BodyComments", MCEventType.OnLoad, FMCOnBodyCommentsLoaded, null );
  46.     }
  47.     
  48.     if ( MCGlobals.TopicCommentsFrame != null )
  49.     {
  50.         FMCRegisterCallback( "TopicComments", MCEventType.OnInit, FMCOnTopicCommentsInit, null );
  51.     }
  52.     
  53.     var rootFrame    = FMCGetRootFrame();
  54.  
  55.     if ( rootFrame )
  56.     {
  57.         rootFrame.FMCHighlightUrl( window );
  58.     }
  59.     else if ( typeof( FMCHighlightUrl ) != "undefined" )
  60.     {
  61.         FMCHighlightUrl( window );
  62.     }
  63.     
  64.     //
  65.  
  66.     if ( MCGlobals.RootFrame == null && !FMCIsTopicPopup() )
  67.     {
  68.         var framesetLinks    = FMCGetElementsByClassRoot( document, "MCWebHelpFramesetLink" );
  69.         
  70.         for ( var i = 0; i < framesetLinks.length; i++ )
  71.         {
  72.             var framesetLink    = framesetLinks[i];
  73.             framesetLink.style.display = "";
  74.         }
  75.     }
  76.  
  77.     //
  78.  
  79.     if ( typeof( gServiceClient ) != "undefined" && typeof( gServiceClient.LogTopic ) == "function" && !FMCIsSkinPreviewMode() )
  80.     {
  81.         var topicID    = FMCGetMCAttribute( document.documentElement, "MadCap:liveHelp" );
  82.  
  83.         gServiceClient.LogTopic( topicID );
  84.     }
  85.  
  86.     //
  87.  
  88.     gInit = true;
  89. }
  90.  
  91. function FMCOnTocInitialized()
  92. {
  93.     if ( MCGlobals.NavigationFrame.frames["toc"].gSyncTOC )
  94.     {
  95.         FMCSyncTOC();
  96.     }
  97. }
  98.  
  99. function FMCOnToolbarLoaded()
  100. {
  101.     if ( FMCIsLiveHelpEnabled() && MCGlobals.ToolbarFrame.document.getElementById( "RatingIcons" ) != null )
  102.     {
  103.         MCGlobals.ToolbarFrame.SetRating( 0 );
  104.         
  105.         FMCUpdateToolbarRating();
  106.     }
  107. }
  108.  
  109. function FMCUpdateToolbarRating()
  110. {
  111.     var topicID    = FMCGetMCAttribute( document.documentElement, "MadCap:liveHelp" );
  112.  
  113.     gServiceClient.GetAverageRating( topicID, FMCBodyGetRatingOnComplete, null );
  114. }
  115.  
  116. function FMCOnBodyCommentsLoaded()
  117. {
  118.     MCGlobals.BodyCommentsFrame.Init( OnInit );
  119.     
  120.     function OnInit()
  121.     {
  122.         MCGlobals.BodyCommentsFrame.RefreshComments();
  123.     }
  124. }
  125.  
  126. function FMCOnTopicCommentsInit()
  127. {
  128.     var topicCommentsFrame    = MCGlobals.TopicCommentsFrame;
  129.  
  130.     topicCommentsFrame.RefreshComments();
  131. }
  132.  
  133. function FMCBodyGetRatingOnComplete( averageRating, ratingCount, onCompleteArgs )
  134. {
  135.     var toolbarFrame    = MCGlobals.ToolbarFrame;
  136.     
  137.     toolbarFrame.SetRating( averageRating );
  138. }
  139.  
  140. function FMCCheckForBookmark()
  141. {
  142.     var hash    = document.location.hash;
  143.     
  144.     if ( !hash )
  145.     {
  146.         return;
  147.     }
  148.     
  149.     var bookmark    = null;
  150.     
  151.     if ( hash.charAt( 0 ) == "#" )
  152.     {
  153.         hash = hash.substring( 1 );
  154.     }
  155.     
  156.     var currAnchor  = null;
  157.     
  158.     for ( var i = 0; i < document.anchors.length; i++ )
  159.     {
  160.         currAnchor = document.anchors[i];
  161.         
  162.         if ( currAnchor.name == hash )
  163.         {
  164.             bookmark = currAnchor;
  165.             
  166.             break;
  167.         }
  168.     }
  169.     
  170.     if ( currAnchor )
  171.     {
  172.         FMCUnhide( window, currAnchor );
  173.         
  174.         // Mozilla didn't navigate to the bookmark on load since it was inside a hidden node. So, after we ensure it's visible, navigate to the bookmark again.
  175.         
  176.         if ( !document.body.currentStyle )
  177.         {
  178.             document.location.href = document.location.href;
  179.         }
  180.     }
  181. }
  182.  
  183. function FMCSyncTOC()
  184. {
  185.     if ( !MCGlobals.NavigationFrame.frames["toc"] || MCGlobals.BodyFrame.document != document )
  186.     {
  187.         return;
  188.     }
  189.     
  190.     var tocPath = FMCGetMCAttribute( document.documentElement, "MadCap:tocPath" );
  191.     
  192.     MCGlobals.NavigationFrame.frames["toc"].SyncTOC( tocPath );
  193. }
  194.  
  195. function FMCGlossaryTermHyperlinkOnClick( node )
  196. {
  197.     var navFrame    = MCGlobals.NavigationFrame;
  198.     var anchorName    = FMCGetMCAttribute( node, "MadCap:anchor" );
  199.     
  200.     navFrame.SetActiveIFrameByName( "glossary" );
  201.     navFrame.frames["glossary"].DropDownTerm( anchorName );
  202. }
  203.